<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
	<%= javascript_include_tag :defaults, "jquery.template", "swfobject", "jquery.uploadify", "jquery.form", 'jquery.innerfade', 'jquery.color.js'  %>
	<%= javascript_include_tag "tiny_mce/jquery.tinymce" if (["new","create", "update", "edit"].include?(params[:action].to_s)) %>
	<%= include_autocomplete %>	
	<%= stylesheet_link_tag 'main','jquery-ui', 'jquery.uploadify' %>	
	<title><%= @page_title ? @page_title + " by Nerto.it" : I18n.t('layout.title') %></title>	
</head>
<body>
	<%= fb_connect_javascript_tag %>
	<%= init_fb_connect%>	
	<div id="main_menu">		
		<div id="left_main_menu">
			<img src="/images/main_menu_logo.gif" alt="nerto logo" id="logo_main_menu" />
		</div>		
		<div id="right_main_menu">		
			<div id="angle_dx_main_menu"><span></span></div>	
			
			<%= image_tag(current_user.get_avatar(:thumb_mini), :class => "left") if user_logged_in? %>
			<div id="user_main_menu"
				<% if user_logged_in? %> >					
						<a href="#" style="background-color:#<%= current_user.colors %>;" id="username_main_menu"><%= current_user.name %></a>
						<a href="/logout" id="logout_main_menu">LOGOUT</a>						
				<% else %> style="line-height:25px;" >
						<a href="#" id="login_lnk" class="login_lnk">LOGIN</a> | <a href="/signup" class="login_lnk">REGISTER</a>
				<% end %>
			</div>			
			<div id="location_main_menu">
				<% if @user_location and @user_location.full_address.to_s != "" %>
					<div id="location_name_main_menu" 
						title="<%= @user_location.full_address %>">
							<%= @user_location.full_address[0, @user_location.full_address.to_s.index(",")] %>
					</div>
					<span>CAMBIA LOCATION</span>
				<% end %>
			</div>
			<div id="change_location_main_menu"></div>
			
			<div class="separator"><span></span></div>
		</div>		
		<div class="separator"><span></span></div>
		<div id="location_div_main_menu">
			<% form_tag "/user/change_location", :id => "location_form_main_menu", :class => "form_main_menu"  do -%>
				<p style="text-align:right;">
					<%= label_tag "location_field_menu", Location.human_attribute_name("full_address") %>	
					<%= text_field_tag 'location_menu' %>
				</p>
			<%end -%>
		</div>
		<!--<a href="?locale=it"><img src="/images/locale_it.gif" alt="Italiano" /></a>
		<a href="?locale=en"><img src="/images/locale_en.gif" alt="English" /></a>-->
			
	</div>	
	<div id="main">
		<div id="sections_main_menu">
			<div class="section_main_menu"><a href="#">EVENTI</a></div>
			<div class="section_main_menu"><a href="#">POSTI</a></div>
			<div class="section_main_menu"><a href="#">ARTISTI</a></div>
			<div class="section_main_menu"><a href="#">RECENSIONI</a></div>
			<div class="section_main_menu"><a href="#">UTENTI</a></div>
			<div class="separator"><span></span></div>
		</div>
		<%=@content_for_layout%>		
	</div>

	<div id="login_div_main_menu">
		<div id="login_internal_div_main_menu">
			<div style="background-color:white;width:55px;height:3px;margin-left:-10px;margin-top:-13px;position:absolute;"></div>
	<% unless user_logged_in? 					
			 form_tag session_path, :login => "login_form_main_menu", :class => "form_main_menu"  do -%>
				<table>
					<tr>
						<td><%= label_tag 'email' %></td>
						<td><%= text_field_tag 'login', @login %></td>
					</tr>
					<tr>
						<td><%= label_tag 'password' %></td>
						<td><%= password_field_tag 'password', nil %></td>
					</tr>
					<tr>
						<td><%= label_tag I18n.t('login.remember_me'), I18n.t('login.remember_me') %></td>	
						<td><%= check_box_tag 'remember_me', '0', @remember_me %>
								<%= submit_tag 'Login' %></td>
					</tr>
				</table>
				<%= link_to I18n.t('login.forgot_password') + "?", forgot_password_url %></p>
				<p><%=t "login.or_login_with_facebook" %></p>
				<%= fb_login_button("window.location = '/users/link_user_accounts';")%>
			<%end 
		end -%>
		</div>
	</div>

</body>
</html>
